class BaseProductionstation {
  String? id;
  String? teamId;
  String? teamName;
  String? workshopId;
  String? workshopName;
  String? factoryId;
  String? factoryName;
  String? remark;
  String? sequence;
  String? active;
  String? createUid;
  String? createDate;
  String? writeUid;
  String? writeDate;
  String? stationcode;
  String? stationname;

  BaseProductionstation({
    this.id,
    this.teamId,
    this.teamName,
    this.workshopId,
    this.workshopName,
    this.factoryId,
    this.factoryName,
    this.remark,
    this.sequence,
    this.active,
    this.createUid,
    this.createDate,
    this.writeUid,
    this.writeDate,
    this.stationcode,
    this.stationname,
  });

  BaseProductionstation copyWith({
    String? id,
    String? workshopId,
    String? teamId,
    String? factoryId,
    String? processId,
    String? remark,
    String? sequence,
    String? active,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
    String? stationcode,
    String? stationname,
  }) {
    return new BaseProductionstation(
      id: id ?? this.id,
      workshopId: workshopId ?? this.workshopId,
      teamId: teamId ?? this.teamId,
      factoryId: factoryId ?? this.factoryId,
      remark: remark ?? this.remark,
      sequence: sequence ?? this.sequence,
      active: active ?? this.active,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
      stationcode: stationcode ?? this.stationcode,
      stationname: stationname ?? this.stationname,
    );
  }

  @override
  String toString() {
    return '''BaseProductionstation{
      id: id,
      workshopId: workshopId,
      teamId: teamId,
      factoryId: factoryId,
      processId: processId,
      remark: remark,
      sequence: sequence,
      active: active,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
      stationcode: stationcode,
      stationname: stationname,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is BaseProductionstation &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          workshopId == other.workshopId &&
          teamId == other.teamId &&
          factoryId == other.factoryId &&
          remark == other.remark &&
          sequence == other.sequence &&
          active == other.active &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate &&
          stationcode == other.stationcode &&
          stationname == other.stationname);

  factory BaseProductionstation.fromMap(Map<String, dynamic> map) {
    return new BaseProductionstation(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      workshopId: map['workshop_id'] != false
          ? map['workshop_id'][0].toString() as String?
          : "",
      workshopName: map['workshop_id'] != false
          ? map['workshop_id'][1].toString() as String?
          : "",
      teamId:
          map['team_id'] != false ? map['team_id'][0].toString() as String? : "",
      teamName: map['team_id'] != false
          ? map['team_id'][1].toString() as String?
          : "",
      factoryId: map['factory_id'] != false
          ? map['factory_id'].toString() as String?
          : "",
      factoryName: map['factory_id'] != false
          ? map['factory_id'][1].toString() as String?
          : "",
      remark: map['remark'] != false ? map['remark'].toString() as String? : "",
      sequence:
          map['sequence'] != false ? map['sequence'].toString() as String? : "",
      active: map['active'] != false ? map['active'].toString() as String? : "",
      createUid: map['create_uid'] != false
          ? map['create_uid'][1].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
      stationcode: map['stationcode'] != false
          ? map['stationcode'].toString() as String?
          : "",
      stationname: map['stationname'] != false
          ? map['stationname'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'workshopId': this.workshopId,
      'teamId': this.teamId,
      'factoryId': this.factoryId,
      'remark': this.remark,
      'sequence': this.sequence,
      'active': this.active,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
      'stationcode': this.stationcode,
      'stationname': this.stationname,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.factoryId != null && this.factoryId != '')
        ['factory_id', '=', int.parse(this.factoryId!)],
      if (this.workshopId != null && this.workshopId != '')
        ['workshop_id', '=', int.parse(this.workshopId!)],

      if (this.stationcode != null && this.stationcode != '')
        ['stationcode', 'like', '%${this.stationcode}%'],
      if (this.stationname != null && this.stationname != '')
        ['stationname', 'like', '%${this.stationname}%'],
    ] as List;
    // if (list.length == 0) {
    //   list.add(['id', '!=', null]);
    // }
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'workshop_id': this.workshopId,
      'team_id': this.teamId,
      'factory_id': this.factoryId,
      'remark': this.remark,
      'sequence': this.sequence,
      'active': this.active,
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
      'stationcode': this.stationcode,
      'stationname': this.stationname,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
